﻿<!--<div class="container-fluid navbar-fixed-top top-bar">
    <div class="container-title">
        <div class="container-title-back" ng-click="back()"></div>
        <div class="container-title-main">备案点位置</div>
        <div class="container-title-sure" ng-click="chose()">确定</div>
    </div>
</div>
<div class="clear50"></div>
<div id="allmap"></div>
<style type="text/css">
    body, html, #allmap {
        width: 100%;
        height: 100%;
        overflow: hidden;
        margin: 0;
        font-family: "微软雅黑";
    }
</style>
<script type="text/javascript">
    function init() {
        var xy = window.location.href;
        var xy2 = new Array;
        xy2 = xy.split("/");
        var length = xy2.length;
        var xy3 = xy2[length - 1];
        var xy4 = xy3.split(",");
        var x = xy4[0];
        var y = xy4[1];
        var map = new BMap.Map("allmap");
        var point = new BMap.Point(x, y);
        var point2 = JSON.stringify(point)
        window.localStorage.setItem("opoint", point2);
        setTimeout(function () {
            var convertor = new BMap.Convertor();
            var pointArr = [];
            pointArr.push(point);
            convertor.translate(pointArr, 1, 5, translateCallback)
        }, 1000);
        translateCallback = function (data) {
            if (data.status === 0) {
                var marker = new BMap.Marker(data.points[0]); // 创建标注
                map.addOverlay(marker);// 将标注添加到地图中
                map.centerAndZoom(data.points[0], 17);
                marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
                map.enableScrollWheelZoom(true);//启用滚轮放大缩小
            }
        }

        function showInfo(e) {
            var omark = window.localStorage.getItem("opoint");
            var omarker = new BMap.Marker(omark);
            map.clearOverlays(omarker)
            var marker = new BMap.Marker(e.point);  // 创建标注
            var point2 = JSON.stringify(e.point)
            window.localStorage.setItem("opoint", point2);
            map.addOverlay(marker);               // 将标注添加到地图中
        }
        map.addEventListener("click", showInfo);
    }
    $(function () {
        //百度地图API功能
        var script = document.createElement("script");
        script.type = "text/javascript";
        script.src = "http://api.map.baidu.com/api?v=2.0&ak=Hl4U00mw93xoS1kSDnqk8P6t&callback=init";
        document.body.appendChild(script);
    })
</script>-->
<div class="container-fluid navbar-fixed-top top-bar">
    <div class="container-title">
        <div class="container-title-back" ng-click="back()"></div>
        <div class="container-title-main">备案点位置</div>
        <div class="container-title-sure" ng-click="chose()">确定</div>
    </div>
</div>
<div class="clear50"></div>
<div id="mapDiv"></div>
<style type="text/css">
    body, html, #mapDiv {
        /*width: 100%;
        height: 600px;*/
        overflow: hidden;
        margin: 0;
        font-family: "微软雅黑";
    }
</style>
<link rel="stylesheet" href="http://www.nbmap.gov.cn/leaflet/leaflet.css">
<script>
    var width = window.innerWidth;
    var height = window.innerHeight;
    $("#mapDiv").css("width", width);
    $("#mapDiv").css("height", height);
    //添加瓦片图层
    var layers = [];
    layers.push(new L.TileLayer.TDT.Vector());
    layers.push(new L.TileLayer.TDT.VectorAnno());
    map = new L.map('mapDiv', { layers: layers, attribution: false, zoomControl: false, crs: L.CRS.CustomLevel });
    var xy = window.location.href;
    var xy2 = new Array;
    xy2 = xy.split("/");
    var length = xy2.length;
    var xy3 = xy2[length - 1];
    var xy4 = xy3.split(",");
    var x = xy4[0];
    var y = xy4[1];
    var x1 = parseFloat(x);
    var y1 = parseFloat(y);
    map.setView([y1, x1], 17);
    //自定义marker
    var markericon = L.icon({ iconUrl: '../images/flickr.png', iconSize: [15, 15] });
    //定义标注并添加至地图
    L.marker([y1, x1]).addTo(map);
    window.localStorage.setItem("opointx", x1);
    window.localStorage.setItem("opointy", y1);
    map.on('click', function (evt) {
        var x = window.localStorage.getItem("opointx");
        var y = window.localStorage.getItem("opointy");
        var x1 = parseFloat(x);
        var y1 = parseFloat(y);
        $(".leaflet-marker-pane img").remove();
        $(".leaflet-shadow-pane img").remove();
        map.setView([evt.latlng.lat, evt.latlng.lng]);
        var markericon = L.icon({ iconUrl: '../images/flickr.png', iconSize: [15, 15] });
        //定义标注并添加至地图
        L.marker([evt.latlng.lat, evt.latlng.lng]).addTo(map);
    });
</script>